package com.pricetag.pricetagandroid;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.RotateAnimation;
import android.widget.ImageView;

public class AnimationActivity extends Activity {

	private Handler mHandler = new Handler();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_animation);

		ImageView animationTarget = (ImageView) this.findViewById(R.id.testImage);
		Animation newAnimation = new RotateAnimation(90, 720, 0, 0);
		newAnimation.setDuration(1800);
		animationTarget.startAnimation(newAnimation);
		mHandler.postDelayed(mUpdateTimeTask, 2000);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_animation, menu);
		return true;
	}

	private Runnable mUpdateTimeTask = new Runnable() {
		public void run() {
			Intent intent = new Intent(AnimationActivity.this, CameraActivity.class);
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
			finish();
		}
	};

}
